package lol.clann.minecraft.springboot.api.annotation.condition;

import java.lang.annotation.*;

/**
 * Conditional扩展,类似{@ConditionalOnProperty} 不过是从被注解的类所属插件的配置文件里读取
 *
 * @author pyz
 * @date 2019/6/1 10:26 AM
 */
@Repeatable(ConditionalOnConfigs.class)
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
public @interface ConditionalOnConfig {

    /**
     * Alias for {@link #name()}.
     * @return the names
     */
    String[] value();

    /**
     * A prefix that should be applied to each property. The prefix automatically ends
     * with a dot if not specified. A valid prefix is defined by one or more words
     * separated with dots (e.g. {@code "acme.system.feature"}).
     * @return the prefix
     */
    String prefix() default "";

    /**
     * The string representation of the expected value for the properties. If not
     * specified, the property must <strong>not</strong> be equal to {@code false}.
     * @return the expected value
     */
    String[] havingValue();

    /**
     * Specify if the condition should match if the property is not set. Defaults to
     * {@code false}.
     * @return if should match if the property is missing
     */
    boolean matchIfMissing() default false;
}
